package com.song.mapper;

import com.song.annotation.AutoFill;;

import com.song.dto.DishDTO;
import com.song.dto.DishPageQueryDTO;
import com.song.entity.Dish;
import com.song.enumeration.SqlOperationType;
import com.song.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

@Mapper
public interface DishMapper {
    // 查询当前分类下的菜品数量
    @Select("select count(*) from dish where category_id = #{categoryId}")
    Integer getDishCountByCategoryId(Long categoryId);

    //添加菜品
    @AutoFill(SqlOperationType.INSERT)
    Integer addDish(Dish dish);

    //菜品条件分页查询
    List<DishVO> getDishPage(DishPageQueryDTO dishPageQueryDTO);

    //根据ids批量删除菜品
    Integer deleteDish(List<Long> ids);

    //根据id更新菜品数据
    @AutoFill(SqlOperationType.UPDATE)
    Integer updateDish(Dish dish);

    //根据id查询菜品数据
    DishVO getDishByID(Long id);

    List<Dish> getDishListByCategoryId(Long categoryId);

    @AutoFill(SqlOperationType.UPDATE)
    Integer updateDishStatus(Integer status, Long id);

    //根据菜品id查询在售中的菜品
    List<Dish> getSaleDishByIds(List<Long> ids);

    //根据菜品ids查询,菜品关联的套餐数量
    Integer getDishSetmealCountByIds(List<Long> ids);
}
